home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 9 / Night Owl CD-ROM (NOPV9) (Night Owl Publisher) (1993).ISO / 050a / bigtxt17.zip / LZEXE.DOC < prev    next >
Text File  |  1992-08-20  |  11KB  |  243 lines

  1. Documentation for:
  2. -------------------
  3. LZEXE.EXE v0.91 (ß-release) (c) 1989 Fabrice BELLARD
  4. Compressor for EXE files.
  5.  
  6.  
  7. This program is in the public domain (FREEWARE), and you can therefore
  8. use, copy and distribute it freely.  You can also utilize it commercially,
  9. i.e. you can use it on programs you intend to sell.  However, the sale of
  10. LZEXE.EXE itself is forbidden.
  11.  
  12.  
  13. Requirements:  PC and compatibles.  80286 or 80386 microprocessors are
  14. recommended  for greater execution speed.
  15. Memory requirements: 128K minimum are needed to run LZEXE.
  16.  
  17.  
  18. 1-Introduction
  19. --------------
  20.  
  21. This utility compresses EXE files, namely executable files.
  22. You know that there are many other compressors for such files, such as
  23. the excellent PKZIP or LHARC.  This uniqueness of the present method
  24. consists in the fact that the compressed files can be run directly!
  25. For almost all EXE files the decompression time is so short that it is
  26. negligible ! In addition the decompression does not use any extra space
  27. on disk or in RAM.  It simply uses the amount of RAM normally allocated
  28. for the uncompressed file.  The compressor algorithm has been optimized
  29. not only for speed but also for efficiency:  EXE files are reduced almost
  30. to the size of their ZIPped counterparts.  I am working on future releases
  31. which I hope will be even better.
  32.  
  33. 2-Using LZEXE
  34. -------------
  35.  
  36. Usage is very simple: just enter the command line
  37.  
  38.          LZEXE filename
  39.  
  40. where filename is the EXE file to be compressed.  The extension .EXE is
  41. implied by default. "path" is optional: it refers to the directory where
  42. the compacted file and the temporary working file LZTMP.EXE are to be
  43. located.
  44.  
  45. Warning!  Certain files are EXE only by name! For DOS it is not the
  46. extension EXE that characterizes an 'EXE' file, but the presence of a header
  47. with the letters "MZ" followed by information on the length of the file
  48. the space occupied in RAM, etc...  Thus if you change the COM extension to
  49. EXE, LZEXE will refuse to process the file.
  50.  
  51. There is a way to force LZEXE to accept a COM file: just use COMTOEXE by the
  52. same author.  It works like EXE2BIN in reverse.
  53.  
  54. For greater safety LZEXE does not erase the original EXE file, but it renames
  55. it with the extension .OLD.  In addition it creates the temporary file
  56. LZEXE.TMP which is renamed with the name of the original program only at the
  57. end of the compression process.
  58.  
  59. 3-Usage tips
  60. ------------
  61.  
  62. Certain files can not be compressed for various reasons:
  63.  
  64. -  The file is not a true EXE file.  Solution: use COMTOEXE.EXE.
  65. -  The relocation table is too large. To understand this you need to know
  66.    the internal structure of an EXE file: such a file can occupy several
  67.    segments unlike COM files.  Thus it must contain a table specifying where
  68.    to branch and where to call subprograms, etc... And if the program is
  69.    rather large  it may confuse the compressor.  I have provided for a table
  70.    with up to 16,000 relocation addresses, which should suffice for almost
  71.    all EXE files.
  72. -  The file you wish to compress has already been compressed by LZEXE.
  73.    Notice that there exists another compressor:   Microsoft's EXEPACK.EXE,
  74.    which however is far less efficient than LZEXE.  LZEXE can further
  75.    compress an EXEPACKed file, if you use UPACKEXE to unpack what EXEPACK
  76.    has done.
  77. -  Sometimes the compression factor is not significant.  This may happen with
  78.    very small files (less than 2K).  Normally the compression is quite
  79.    substantial.
  80.  
  81.  
  82. -  A more serious problem: certain compressed EXE file may hang the system:
  83.  
  84.     -  If the program checks its size (like Turbo Debugger for example).
  85.     -  If it checks for its integrity on disk.
  86.     -  If it uses overlays, which must be loaded later and thus must occupy
  87.        occupy fixed position in the file.  LZEXE 0.91 warns you of the
  88.        presence of such overlays.
  89.     -  Programs that require Microsoft's Windows:  they are not true EXE
  90.        and will not work properly if compressed with LZEXE.
  91.     -  This list may grow, since I have not experimented with all types
  92.        of EXE files.
  93.  
  94.  
  95. -  A less serious problem: Certain programs use configuration options that
  96.    modify the code (Turbo  Pascal, for example).
  97.    In this case, first configure the program, then compress it.  (Always
  98.    keep an uncompressed version for safety.)
  99.  
  100.  
  101. 4-Some technical notes
  102. ----------------------
  103.  
  104.     The compression algorithm used is based on the Ziv Lempel method,
  105. uses a circular (ring) buffer, and a tree-lile method for finding byte
  106. sequence repeats.  The encoding of the position and length of the repeating
  107. sequences is optimized via an auxiliary algorithm based on the Huffman
  108. method.  Uncompressed bytes are kept unchanged since any further method
  109. (such as Adaptive Huffman, as in LHARC, or Shanon-Fano trees, as in PKZIP)
  110. would have entailed a much longer decompression time, and above all, a much
  111. more complex and larger decompressor, which would have decreased excessively
  112. the compression factor.
  113.  
  114.     The decompressor is located at the end of the compressed EXE file
  115. and is 330 bytes long (in version 0.91). Its functions are:
  116.  
  117. -  Check the CRC to ensure that the file has not be tampred with (useful
  118.    against viruses).  If the test files, the message  "CRC Error" is
  119.    displayed.  However, I've removed this from version 0.91 because it
  120.    increased the size of the file and the time spent i decompressing.  Further,
  121.    the crc check was only done on the decompressor.
  122. -  Locate itself in high RAM, then move the compressed code in order to
  123.    leave sufficient room to the EXE file.
  124. -  Decompress the code, checking that it is correct, and adjust the sgments
  125.    if more than 64K (this was a hard problem, in terms of speed!).
  126. -  Decompress the relocation table, and update the relocatable addresses
  127.    of the EXE file.  Improvements have been made in this version to getter
  128.    better compression.
  129. -  Run the program, updating the CS,IP,SS,SP registers.
  130.  
  131. That's all!!!
  132.  
  133.     This decompressor is by itself a little jewel of 8086 assembler
  134. programming. It goes without saying that it was hard work.  But the
  135. compressor was not much easier, particularly with regard to the updating
  136. all the pointers that the decompressor needs in order to function.
  137.  
  138.  
  139. 5-LZEXE and the other compressors
  140. ---------------------------------
  141.  
  142. PKARC (latest version):  LZEXE    is much better:  "crunching" (alias
  143. Shrinking for PKZIP) is outdated...
  144.  
  145. PKZIP v0.92: LZEXE is better in most cases.
  146.  
  147. PKZIP v1.02: better than LZEXE with large files due to "imploding", since this
  148. algorithm is a subset of mine, but the decompressor is slower than mine.  On
  149. smaller files the difference is minimal.
  150.  
  151. LHARC v1.01:  better than LZEXE due to "freezing", but same remark as
  152. for PKZIP v1.02.
  153.  
  154. LARC: LZEXE is better.
  155.  
  156. Important notes:
  157.  
  158. - One can not truly compare LZEXE with these other products. since the
  159. files compressed with my method contain a decompressor which runs the
  160. programs by itself.  It is true that the other compressor can create
  161. "self-extracting" files, but they do so on disk, are slow and add sveral
  162. scores of K to the compressed files (except for PKARC and LHARC, which add
  163. only 1 or 2K., but only decompress to disk, unfortunately.)
  164. - In almost all cases. the compressors mentioned can not further compress
  165. a file already compressed with LZEXE, which demonstrates the high
  166. efficiency of thismethod.
  167.  
  168.  
  169. 6-The future...
  170. ---------------
  171.  
  172. - I want to develop soon a decompressor which allows the recreation of the
  173. original EXE file from the compressed one.  Its usefulness is questionable,
  174. - I intend to optimize further the decompressor for speed,  and the
  175. compressor for efficiency, by further reducing the relocation table, for
  176. example (I already have a few ideas...);  adding a password system, and
  177. creating an 80836 version which should speed things quite abit.
  178. - I intend to develop a decompressor for  Microsoft's EXEPACKed files, which
  179. is interesting because my compressor works better on files which have not
  180. been treated with EXEPACK.
  181. - I am also thinking of an automatic document-decompressor of the LIZEMOI.COM
  182. or LIST.COM type, which should be very handy.
  183. - Finally, I hope to create a "universal" compressor, like PKZIP or LHARC,
  184. slower than LZEXE in decompression, but better than the existing ones.
  185.  
  186.  
  187.  
  188. 7-Warnings...
  189. -------------
  190.  
  191. I hope that LZEXE and the files it can create may become very popular...
  192. a good incentive for further work.
  193.  
  194. I shall not be responsible in any way for any loss of data caused by LZEXE>
  195. But rest assured: the algorithms are reliable and I do not believe there
  196. are many bugs. If the EXE program created by LZEXE functions properly the
  197. first time, then it will always do so!
  198.  
  199. Warning!  I advise against compressing and distributing commercial software
  200. protected by copyright.  The authors may not like it...
  201.  
  202. But if you create a piece of FREEWARE or SHAREWARE,  or even a commercial
  203. product,  nothing prevents you from compressing it with LZEXE.    In fact, I
  204. urge youto do so:
  205.  
  206. - Your EXE files will be smaller and people may even think you programmed
  207. them in assembler.  Your competitors will be amazed by your software, which
  208. does what their does butis 30% smaller.
  209. In addition you will have more space on your floppy and hard disks.  Space
  210. is always at a premium...
  211. -  Compressed programs are always less vulnerable to viruses, since any
  212. interference will cause the "CRC error" to appear or the system to hang.
  213. -  The compression constitutes an excellent encryption system, preventing
  214. unscrupulous people from hacking your messages or examine your algorithms.
  215. The only way would be to disassemble the decompressor, which is not going
  216. to be easy, I tell you!
  217.  
  218.  
  219.     That's it!  I hope you enjoy this utility.  Please remember it is
  220. still in its ß-state!
  221.  
  222.  
  223.     Fabrice.
  224.  
  225.     If you would like more information on the algorithms used, or in case of
  226. difficulties, here is my address:
  227.  
  228.     Fabrice BELLARD
  229.     451 chemin du mas de Matour
  230.     34790 GRABELS  (FRANCE)
  231.  
  232.     Changes in v0.91:
  233.     ----------------
  234.     -The dash, "-", is now acceptable character in file names.
  235.     -LZEXE now points out the presence of internal overlays
  236.     -LZEXE indicates if the file has been packed with EXEPACK
  237.     -A bug under v0.90 has been fixed.  It made programs occupy too
  238.      much memory when running.
  239.     -The relocation table has been improved
  240.     -CRC control has been removed
  241.     -The compression tail's size has been reduced from 385 to 330 bytes.
  242.  
  243.